package cn.iocoder.yudao.module.system.dal.mysql.tenant;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.institution.InstitutionPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.InstitutionDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 机构管理 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface InstitutionMapper extends BaseMapperX<InstitutionDO> {

    default PageResult<InstitutionDO> selectPage(InstitutionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InstitutionDO>().likeIfPresent(InstitutionDO::getName, reqVO.getName()).eqIfPresent(InstitutionDO::getLogoUrl, reqVO.getLogoUrl()).eqIfPresent(InstitutionDO::getImageUrl, reqVO.getImageUrl()).eqIfPresent(InstitutionDO::getProvinceCode, reqVO.getProvinceCode()).likeIfPresent(InstitutionDO::getProvinceName, reqVO.getProvinceName()).eqIfPresent(InstitutionDO::getCityCode, reqVO.getCityCode()).likeIfPresent(InstitutionDO::getCityName, reqVO.getCityName()).eqIfPresent(InstitutionDO::getDistrictCode, reqVO.getDistrictCode()).likeIfPresent(InstitutionDO::getDistrictName, reqVO.getDistrictName()).eqIfPresent(InstitutionDO::getMajor, reqVO.getMajor()).eqIfPresent(InstitutionDO::getAddress, reqVO.getAddress()).eqIfPresent(InstitutionDO::getTrainingAddress, reqVO.getTrainingAddress()).eqIfPresent(InstitutionDO::getContactPerson, reqVO.getContactPerson()).eqIfPresent(InstitutionDO::getContactPhone, reqVO.getContactPhone()).betweenIfPresent(InstitutionDO::getLicenseStartDate, reqVO.getLicenseStartDate()).betweenIfPresent(InstitutionDO::getLicenseEndDate, reqVO.getLicenseEndDate()).eqIfPresent(InstitutionDO::getStatus, reqVO.getStatus()).betweenIfPresent(InstitutionDO::getCreateTime, reqVO.getCreateTime()).eqIfPresent(InstitutionDO::getRemark, reqVO.getRemark()).orderByDesc(InstitutionDO::getId));
    }

}